/**
 * Created by IntelliJ IDEA.
 * User: user
 * Date: 19.06.12
 * Time: 09:21
 * To change this template use File | Settings | File Templates.
 */
package AS3.constants.combo {
import flash.sampler.sampleInternalAllocs;
import flash.utils.Dictionary;

import mx.controls.Alert;

public class IndustrialEmissionReduction {
    public function IndustrialEmissionReduction() {
    }

    public static const ACTUAL:int = 0;
    public static const REDUCTION_20_PER_CENT:int = 1;
    public static const REDUCTION_40_PER_CENT:int = 2;
    public static const REDUCTION_60_PER_CENT:int = 3;
    public static const REDUCTION_80_PER_CENT:int = 4;
    public static const REDUCTION_100_PER_CENT:int = 5;

    static private var reductionMap:Dictionary;

    static public function getReduction(code:int):Number{
        var result:Number = 0.0;

        if (reductionMap == null) {
            reductionMap = createMap();
        }
        if (reductionMap.hasOwnProperty(code)) {
            result = reductionMap[code];
        }


        return result;
    }

    static private function  createMap():Dictionary {
        var result:Dictionary = new Dictionary();
        result[ACTUAL] = 1.0;
        result[REDUCTION_20_PER_CENT] = 0.8;
        result[REDUCTION_40_PER_CENT] = 0.6;
        result[REDUCTION_60_PER_CENT] = 0.4;
        result[REDUCTION_80_PER_CENT] = 0.2;
        result[REDUCTION_100_PER_CENT] = 0.0;


        return result;
    }
}
}
